package com.core.zyyz.pcmc.service.impl;
import java.util.List;
import java.util.UUID;

import com.core.zyyz.pcmc.domain.PcmcChannel;
import com.core.zyyz.pcmc.mapper.PcmcChannelMapper;
import com.core.zyyz.pcmc.service.PcmcChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 渠道Service业务层处理
 *
 * @author core
 * @date 2024-10-24
 */
@Service
public class PcmcChannelServiceImpl implements PcmcChannelService
{
    @Autowired
    private PcmcChannelMapper pcmcChannelMapper;

    /**
     * 查询渠道
     *
     * @param channelId 渠道主键
     * @return 渠道
     */
    @Override
    public PcmcChannel selectPcmcChannelByChannelId(String channelId)
    {
        return pcmcChannelMapper.selectPcmcChannelByChannelId(channelId);
    }

    /**
     * 查询渠道列表
     *
     * @param pcmcChannel 渠道
     * @return 渠道
     */
    @Override
    public List<PcmcChannel> selectPcmcChannelList(PcmcChannel pcmcChannel)
    {
        return pcmcChannelMapper.selectPcmcChannelList(pcmcChannel);
    }

    /**
     * 新增渠道
     *
     * @param pcmcChannel 渠道
     * @return 结果
     */
    @Override
    public int insertPcmcChannel(PcmcChannel pcmcChannel)
    {
        pcmcChannel.setChannelSecret(UUID.randomUUID().toString());
        return pcmcChannelMapper.insertPcmcChannel(pcmcChannel);
    }

    /**
     * 修改渠道
     *
     * @param pcmcChannel 渠道
     * @return 结果
     */
    @Override
    public int updatePcmcChannel(PcmcChannel pcmcChannel)
    {
        return pcmcChannelMapper.updatePcmcChannel(pcmcChannel);
    }

    /**
     * 批量删除渠道
     *
     * @param channelIds 需要删除的渠道主键
     * @return 结果
     */
    @Override
    public int deletePcmcChannelByChannelIds(String[] channelIds)
    {
        return pcmcChannelMapper.deletePcmcChannelByChannelIds(channelIds);
    }

    /**
     * 删除渠道信息
     *
     * @param channelId 渠道主键
     * @return 结果
     */
    @Override
    public int deletePcmcChannelByChannelId(String channelId)
    {
        return pcmcChannelMapper.deletePcmcChannelByChannelId(channelId);
    }
}
